#include <Element>

Element::Element(QObject *parent) :
    QObject(parent)
{
    m_fAngle.setValue(0.0f);
    m_scale.setValue(QPointF(1.0f, 1.0f));
}

QTransform Element::transform() const
{
    QTransform result;

    return result;
}

void Element::updateTransform()
{
    // implemented in inherited classes
}

void Element::setPos(QPointF pos)
{
    if(m_pos.value() == pos) return;
    m_pos.setValue(pos);
}

const QPointF &Element::pos() const
{
    return m_pos.value();
}

void Element::setAngle(float fAngle)
{
    if(m_fAngle.value() == fAngle) return;
    m_fAngle.setValue(fAngle);
}

float Element::angle() const
{
    return m_fAngle.value();
}

void Element::setScale(QPointF scale)
{
    if(m_scale.value() == scale) return;
    m_scale.setValue(scale);
}

const QPointF &Element::scale() const
{
    return m_scale.value();
}

QPointer<Document> Element::document() const
{
    QPointer<Document> doc = qobject_cast<Document*>(parent());
    Q_ASSERT(doc);
    return doc;
}
